package com.tv189.springbatchtest.paravalid;

import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersInvalidException;
import org.springframework.batch.core.JobParametersValidator;
import org.springframework.util.StringUtils;

/**
 * @ClassName: NameParamValidator
 * @Description: TODO
 * @Author: 19202
 * @Date: 2025/5/14 23:22
 * @Version 1.0
 **/
public class NameParamValidator implements JobParametersValidator {
    @Override
    public void validate(JobParameters jobParameters) throws JobParametersInvalidException {
        String name = jobParameters.getString("name");
        if (!StringUtils.hasText(name)) {
            throw new JobParametersInvalidException("name 参数不能为空");
        }
    }
}
